<?php

/**
 * 支付模块
 * @copyright (c) 2013, Mr.Wang
 * @author Mr.Wang <281762391@qq.com>
 */
class PayModel extends Model {

    function doConfirm($pay_id) {
        $pay = $this->find($pay_id);
        list($uid, $fanfan_id) = explode("_", $pay['connect_id']);
        if ($pay['pay_status'] == 2 && $pay['confirm_status'] == 0) {
            $addData = array(
                "fanfan_id" => $fanfan_id,
                "uid" => $uid,
                "status" => 1
            );
            M("FanfanBuy")->add($addData);
            $where = array(
                'pay_id' => $pay_id
            );
            $saveData = array(
                'confirm_status' => 1,
                'confirm_time' => time()
            );
            $this->where($where)->save($saveData);
        } else {
            service("Pay:Pay")->payLogs($pay_id, "doConfirm_错误处理", time(), -1);
        }
    }

    function jumpUrl() {
        return U("User/fanfan/index");
    }

}

?>
